﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Data;

namespace DongleManage.Model.BaseClass
{
    [DataContract]
    public class BaseEntity
    {
        /// <summary>
        /// 输入人ID
        /// </summary>
        [DataMember]
        [DisplayName("输入人ID")]
        public int? InUserID { get; set; }

        /// <summary>
        /// 编辑人ID
        /// </summary>
        [DataMember]
        [DisplayName("编辑人ID")]
        public int? EditUserID { get; set; }

        /// <summary>
        /// 输入时间
        /// </summary>
        [DataMember]
        [DisplayName("输入时间")]
        public DateTime? InDate { get; set; }

        /// <summary>
        /// 编辑时间
        /// </summary>
        [DataMember]
        [DisplayName("编辑时间")]
        public DateTime? EditDate { get; set; }

        public BaseEntity()
        { }

        public BaseEntity(IDataReader dataReader)
        {
            
            InUserID = Convert.IsDBNull("InUserID") ? null : (int?)Convert.ToInt32(dataReader["InUserID"].ToString());
            EditUserID = Convert.IsDBNull("EditUserID") ? null : (int?)Convert.ToInt32(dataReader["EditUserID"].ToString());
            InDate = Convert.IsDBNull("InDate") ? null : (DateTime?)Convert.ToDateTime(dataReader["InDate"].ToString());
            EditDate = Convert.IsDBNull("EditDate") ? null : (DateTime?)Convert.ToDateTime(dataReader["EditDate"].ToString());
        }
    }
}
